package com.jiexin.util;

/**
 * @author booker
 * @create 2018-02-23 13:32
 */
public final class ExceptionUtil {

    public static Throwable getCause(Throwable e) {
        if (e.getCause() != null) {
            return getCause(e.getCause());
        }
        return e;
    }

    /**
     * 获取嵌套的异常
     * @param e
     * @return
     */
    public static String createError(Throwable e) {
        Throwable cause = getCause(e);
        return cause.getMessage();
    }
}
